﻿using System;
using System.Collections.Generic;

using Fuse8.DomainFramework.Common;
using Fuse8.ContentManagementFramework.Domain;

namespace Fuse8.ContentManagementFramework.Administration.Models
{
    [Serializable]
    public class CmsAdminAnnotationModel
    {
        public int EntityId { get; set; }

        public string EntityTypeParameter { get; set; }

        public IEnumerable<CmsAdminAnnotationColorScheme> ColorDefinitions { get; set; }

        public IEnumerable<CmsEntityAnnotationModel> Notes { get; set; }

        public int CurrentUserGroupId { get; internal set; }

        public CmsUser CurrentUser { get; internal set; }
    }

    [Serializable]
    public class CmsAdminAnnotationColorScheme
    {
        public int UserGroupId { get; set; }

        public string UserGroupName { get; set; }
        
        public string Color { get; set; }
    }

    [Serializable]
    public class CmsEntityAnnotationModel : CmsEntityAnnotation
    {
        public int UserGroupId { get; set; }

        public CmsEntityAnnotationModel()
        { }
        
        public CmsEntityAnnotationModel(CmsEntityAnnotation annotation)
        {
            Guard.ArgumentNotNull(annotation, "annotation");
            
            this.AnnotationText = annotation.AnnotationText;
            this.Comments = annotation.Comments;
            this.CreatedBy = annotation.CreatedBy;
            this.EntityId = annotation.EntityId;
            this.EntityTypeParameter = annotation.EntityTypeParameter;
            this.Id = annotation.Id;
            this.IsMinimized = annotation.IsMinimized;
            this.X = annotation.X;
            this.Y = annotation.Y;
            this.Z = annotation.Z;
        }
    }

    [Serializable]
    public class CmsAdminAnnotationSaveModel
    {
        public int EntityId { get; set; }

        public string EntityTypeParameter { get; set; }

        public IList<int> AnnotationsForDelete { get; set; }

        public IList<int> CommentsForDelete { get; set; }

        public IList<CmsAdminAnnotationForSaveModel> Notes { get; set; }
    }
    
    [Serializable]
    public class CmsAdminAnnotationForSaveModel
    {
        public int Id { get; set; }

        public string AnnotationText { get; set; }

        public int X { get; set; }

        public int Y { get; set; }

        public int Z { get; set; }

        public bool IsMinimized { get; set; }

        public bool IsDeleted { get; set; }

        public IList<CmsAdminAnnotationCommentForSaveModel> Comments { get; set; }

        public CmsAdminAnnotationForSaveModel()
        { }
    }

    [Serializable]
    public class CmsAdminAnnotationCommentForSaveModel
    {
        public int Id { get; set; }

        public int AnnotationId { get; set; }

        public string CommentText { get; set; }
    }
}